<?php

namespace app\index\model;

use think\Model;

/**
 * 社群推荐
 * @package app\admin\model
 */
class ResourceRecommend extends Model
{
    /**
     * 删除推荐列表
     * @param $where
     * @return bool
     */
    public static function delResourceRecommend($where)
    {
        return self::where($where)->delete();
    }

    /**
     * 推荐列字段数据
     * @param $type
     * @param $limit
     * @return array
     */
    public static function columnResourceRecommend($type, $limit)
    {
        return self::where('end_time', '>', time())
            ->where('type', $type)
            ->order('show_time', 'asc')
            ->limit($limit)
            ->column('rid');
    }

    /**
     * 更新推荐列表
     * @param $data
     * @param $where
     * @return ResourceRecommend
     */
    public static function updateResourceRecommend($data, $where)
    {
        return self::update($data, $where);
    }
}